Page({
  data: {
    subjects: [
      { id: 1, name: '语文', icon: '📚', color: '#ff9800' },
      { id: 2, name: '数学', icon: '📊', color: '#2196f3' },
      { id: 3, name: '英语', icon: '🌍', color: '#4caf50' }
    ],
    recentExams: [],
    recentRecords: []
  },
  
  onLoad: function(options) {
    // 加载最近的考试和记录
    this.loadRecentData();
  },
  
  // 加载最近数据
  loadRecentData: function() {
    // 这里应该添加云函数调用加载数据
    // 临时使用本地数据
    this.setData({
      recentExams: [
        { id: 1, title: '语文期中测试卷', subject: '语文', questionCount: 50, deadline: '2023-05-15', status: '未开始' },
        { id: 2, title: '数学模拟考试', subject: '数学', questionCount: 45, deadline: '2023-05-10', status: '进行中' }
      ],
      recentRecords: [
        { id: 1, title: '语文单元测试', subject: '语文', score: 85, totalScore: 100, createTime: '2023-04-10' },
        { id: 2, title: '数学基础练习', subject: '数学', score: 92, totalScore: 100, createTime: '2023-04-05' }
      ]
    });
  },
  
  // 导航到练习模式
  navigateToPractice: function(e) {
    const subject = e.currentTarget.dataset.subject;
    wx.navigateTo({
      url: `/pages/student/practice/practice?subject=${subject}`,
    });
  },
  
  // 导航到考试页面
  navigateToExam: function(e) {
    const examId = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: `/pages/student/exam/exam?id=${examId}`,
    });
  },
  
  // 导航到成绩分析页面
  navigateToAnalysis: function() {
    wx.navigateTo({
      url: '/pages/student/analysis/analysis',
    });
  }
}) 